﻿#ifndef DAHUACAMERA_H
#define DAHUACAMERA_H

#include "visioncamera.h"
#include "dahuacamera_global.h"
#include <QMutexLocker>
#include <QThread>
#include <QMutex>


class DahuaCameraPrivate;

class DAHUACAMERASHARED_EXPORT DahuaCamera:public VisionCamera
{
public:
    DahuaCamera();
    ~DahuaCamera();

    QString getLastError();

    int connectCamera(QString info);//连接
    int disConnectCamera();//断开

    int startGrabbing();//启动
    int stopGrabbing();//停止

    bool onLineStatus();

    int nextImage(LocalCameraAcquireMode mode = NextImage);
    int getImage(FrameInfo &info);

    int getCameraInfo(QString &info);
    int findCameras(QList<QString> &list);

    int setWorkMode(WorkMode mode = FreeAcquire, std::string lineName = "Line1");
    WorkMode getWorkMode();
    int softTrigger();//必须要先启动相机

    int setExposureTime(double time,std::string name = "ExposureTime");
    double getExposureTime(std::string name = "ExposureTime");

    int setFrameRate(double value);
    double getFrameRate();

    int setFrameRateEnable(bool value);
    int getFrameRateEnable(bool &value);

    int setReverseX(bool value);
    int getReverseX(bool &value);

    int setReverseY(bool value);
    int getReverseY(bool &value);

    int getWidth(long long &width);
    int getHeight(long long &height);

    int setInputIO(IOLine line,bool value);
    int setOutputIO(IOLine line);

private:
    DahuaCameraPrivate *d_ptr;

    QMutex cameraMutex;
};

#endif // DAHUACAMERA_H
